<?php
class AjaxController extends Zend_Controller_Action
{
	public function init() {
		$this->_helper->layout()->disableLayout();
        $this->_helper->viewRenderer->setNoRender(true);
	}

	public function responseAction() {
		$response = array('result' => 'success');
		echo Zend_Json::encode($response);
	}

	public function loadFeedAction() {
	    //$categoryModel = new Application_Model_Categories();
	    $contentModel  = new Application_Model_Content();

		/*$post = $this->getRequest()->getPost();		
		$departmentId = 0;
		if (isset($post['department'])) {
			$departmentId = $categoryModel->getDepartmentIdByCategoryAlias(
				$post['department']
			);			
		}
		$currentCategoryId = $categoryModel->getCategoryIdByAliasAndDepartmentId(
			$post['category'],
			$departmentId
		);
		$allContent = $contentModel->getContentByCategoryId(
			$currentCategoryId,
			$departmentId
		);*/
		$lastPostId = $this->getRequest()->getPost('post_id');
		$allContent = $contentModel->autoloadContentForFeed($lastPostId);
		$content = $contentModel->makePreviewForFeed($allContent);	
		$response = array('result' => $content);
		echo Zend_Json::encode($response);
	}
}